Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] Implement redirection without tee and rotation on windows #49906

Open
wants to merge 33 commits into
base: master
Choose a base branch
from

Conversation

dentiny
Copy link
Contributor

@dentiny dentiny commented Jan 17, 2025

This PR follows #49821 (which only implement linux part), this PR follows up for part of the windows implementation.

Signed-off-by: dentiny <[email protected]>
Signed-off-by: dentiny <[email protected]>
Signed-off-by: dentiny <[email protected]>
Signed-off-by: dentiny <[email protected]>
Signed-off-by: dentiny <[email protected]>
Signed-off-by: dentiny <[email protected]>
Signed-off-by: dentiny <[email protected]>
Signed-off-by: dentiny <[email protected]>
Signed-off-by: dentiny <[email protected]>
Signed-off-by: dentiny <[email protected]>
Signed-off-by: dentiny <[email protected]>
Signed-off-by: dentiny <[email protected]>
Signed-off-by: dentiny <[email protected]>
Signed-off-by: dentiny <[email protected]>
Signed-off-by: dentiny <[email protected]>
Signed-off-by: dentiny <[email protected]>
@dentiny dentiny added the go add ONLY when ready to merge, run all tests label Jan 17, 2025
@dentiny dentiny force-pushed the hjiang/windows-redirection branch from 4000f16 to db56818 Compare January 17, 2025 05:00
@dentiny
Copy link
Contributor Author

dentiny commented Jan 18, 2025

Offline discussion with @jjyao , this PR will focus on windows stream redirection, and I will followup with other two PRs to

  • Cleanup BUILD file for utils targets
  • Use boost in pipe logger to simplify cross-platform logic

@dentiny dentiny requested a review from jjyao January 18, 2025 00:30
@dentiny dentiny force-pushed the hjiang/windows-redirection branch from 3d4e757 to 80220aa Compare January 18, 2025 04:51

std::ostringstream buffer;
buffer << file.rdbuf();
RAY_CHECK(file.good()) << "Fails to read from file " << fname;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After reading, the file should be in the eof state which is not good()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so.

I did a simply experiment.

Setup:

[~] 
ubuntu@hjiang-devbox-pg$ echo "helloworld" > hello.out
[~] 
ubuntu@hjiang-devbox-pg$ g++ -std=c++17 fstream_test.cc -o test
[~] 
ubuntu@hjiang-devbox-pg$ ./test
0
helloworld

Code

#include <fstream>
#include <sstream>
#include <cassert>
#include <iostream>

int main() {
    std::fstream fs("/home/ubuntu/hello.out");
    std::ostringstream buffer;
    buffer << fs.rdbuf();
    std::cout << fs.rdstate() << std::endl;
    std::cout << std::move(buffer).str() << std::endl;
    assert(fs.good());
    return 0;
}

src/ray/util/filesystem.h Outdated Show resolved Hide resolved
src/ray/util/tests/pipe_logger_test.cc Show resolved Hide resolved
src/ray/util/tests/pipe_logger_test.cc Outdated Show resolved Hide resolved
@dentiny dentiny force-pushed the hjiang/windows-redirection branch from 4a19181 to 960b54e Compare January 18, 2025 08:16
@dentiny dentiny requested a review from jjyao January 18, 2025 08:16
@jjyao
Copy link
Collaborator

jjyao commented Jan 18, 2025

Triggered windows tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go add ONLY when ready to merge, run all tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants